package com.ns002.yigou.quote.service;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.TypeReference;
import com.ns002.yigou.quote.domain.Product;
import com.ns002.yigou.quote.globals.RedisKey;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

/**
 * @Author xu
 * @Date 2017/7/28 0028 上午 11:35
 * 产品
 */
@Service
public class ProductService {

    @Autowired
    StringRedisTemplate stringRedisTemplate;

    public List<Product> findProductList(){
        //生产环境暂时还没有部署产品数据
//        stringRedisTemplate.opsForValue().get(RedisKey.PRODUCT_CACHE_JSON

        List<Product> list = JSON.parseObject("[{\"alias\":\"EUR\",\"contract\":\"EUR\",\"contractName\":\"欧洲\",\"flag\":\"1\",\"id\":10,\"org\":\"jm\"},{\"alias\":\"JPY\",\"contract\":\"JPY\",\"contractName\":\"日本\",\"flag\":\"1\",\"id\":11,\"org\":\"jm\"},{\"alias\":\"GBP\",\"contract\":\"GBP\",\"contractName\":\"英国\",\"flag\":\"1\",\"id\":12,\"org\":\"jm\"},{\"alias\":\"AUD\",\"contract\":\"AUD\",\"contractName\":\"澳大利亚\",\"flag\":\"1\",\"id\":13,\"org\":\"jm\"},{\"alias\":\"NZD\",\"contract\":\"NZD\",\"contractName\":\"新西兰\",\"flag\":\"1\",\"id\":14,\"org\":\"jm\"},{\"alias\":\"DINIW\",\"contract\":\"DINIW\",\"contractName\":\"美元指数\",\"flag\":\"1\",\"id\":15,\"org\":\"jm\"}]",
                new TypeReference<List<Product>>(){});
        return list;
    }

}
